package service

import (
	"context"
	"demo/domain/service"
)

// ConvertUrlService 是应用服务，协调领域逻辑
type ConvertUrlService struct {
	urlService *service.UrlMapService
}

// NewConvertUrlService 构造函数
func NewConvertUrlService(urlService *service.UrlMapService) *ConvertUrlService {
	return &ConvertUrlService{urlService: urlService}
}

// CreateUrlMap 创建短映射
func (cs *ConvertUrlService) CreateUrlMap(ctx context.Context, longUrl string, desc string, source string, creator string) string {
	return cs.urlService.CreateUrlMap(ctx, longUrl, desc, source, creator)
}

// ReplaceUrlMap 替换短映射
func (cs *ConvertUrlService) ReplaceUrlMap(ctx context.Context, id int64, longUrl string, desc string, editor string) {
	cs.urlService.ReplaceUrlMap(ctx, id, longUrl, desc, editor)
}
